//
//  HNHappyTimeTalkOtherCell.m
//  XDEducation
//
//  Created by 星道 on 17/8/4.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "HNHappyTimeTalkOtherCell.h"

@implementation HNHappyTimeTalkOtherCell
{
    IBOutlet UIImageView *_Img;
    IBOutlet UILabel *_Name;
    IBOutlet UILabel *_Time;
    IBOutlet UILabel *_Content;
    IBOutlet NSLayoutConstraint *_ContentWidth;
}

- (void)setModel:(HNHappyTimeTalkModel *)Model
{
    _Model = Model;

    _Name.text = [[AccountTool shareAccountTool].currentAccount.uid isEqualToString:[Model.Uid stringValue]] ? @"我":Model.Name;
    _Time.text = Model.Time;
    _Content.text = Model.Content;

    CGSize titleSize = [_Content.text boundingRectWithSize:CGSizeMake(kScreenWidth*0.7, MAXFLOAT) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size;
    _ContentWidth.constant = titleSize.width+5;

    if (![Model.Img isKindOfClass:[NSNull class]] && Model.Img)
    {
        [_Img sd_setImageWithURL:[NSURL URLWithString:Model.Img] placeholderImage:[UIImage imageNamed:@"mine_bnt_user_default"]];
    }
    else
    {
        _Img.image = [UIImage imageNamed:@"mine_bnt_user_default"];
    }

    [self layoutIfNeeded];
}
@end
